#include<iostream>
#include<vector>
#include<string.h>
using namespace std;
int n{0}, tmp{0}, a[103];
vector<int> v;
int dp(int i, int flag);


int main()
{
    int n1{0}, n2{0};
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> tmp;
        v.push_back(tmp);
    }
    // v.push_back(v[0]);
    // n++;
    // if(n == 0) cout << 0 << endl;
    // else if(n == 1) cout << v[0] << endl;
    // else if(n == 2) cout << max(v[0],v[1]) << endl;  // 特殊情况不能忘记讨论
    // else
    // {
    memset(a, 0, sizeof(a));
    //     n1 = dp(0, n-1);
    //     memset(a, 0, sizeof(a));  // 这里要再进行初始化
    //     n2 = dp(1, n);
    //     cout << max(n1, n2);
    // }
    cout << dp(0, 0) << endl;
    return 0;
}


int dp(int i, int flag) // 位置很重要
{
    for(int i = 0; i < n; i++)
    {
        cout << a[i] << " ";
    }
    cout << endl;
    int tmp{0};
    if (i >= n) return 0;
    if(a[i]) return a[i];
    if(v[i] == 0)
    {
        a[i] = 1 + dp(i+1, 0);
        return a[i];

    }
    else if(v[i] == 1)
    {
        if(flag == 1) 
        {
            a[i] = 1 + dp(i+1, 0);
            return a[i];
        }
        else{
            a[i] = min(dp(i+1, 1), 1+dp(i+1,0));
            return a[i];
        }
    }
    else if(v[i] == 2)
    {
        if(flag == 2) 
        {
            a[i] = 1 + dp(i+1, 0);
            return a[i];
        }
        else{
            a[i] = min(dp(i+1, 2), 1+dp(i+1,0));
            return a[i];
        }
    }
    else
    {
        if(flag == 1)
        {
            a[i] = min(1 + dp(i+1, 0), dp(i+1, 2));
            return a[i];
        }
        else if(flag == 2)
        {
            a[i] = min(1 + dp(i+1, 0), dp(i+1, 1));
            return a[i];
        }
        else{
            tmp = min(1 + dp(i+1, 0), dp(i+1, 1));
            a[i] = min(tmp, dp(i+1, 2));
            return a[i];
        }
    }
}